<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php
        if(isset($_POST['button'])){
            switch($_POST['color']){
                case '1':
                    $color = '#FF0000';
                    break;
                case '2':
                    $color = '#009900';
                    break;
                case '3':
                    $color = '#0000FF';
                    break;
                default:
                    $color = '#000000';
            }
            echo <<<str
            <script type="text/javascript">
            window.onload = function(){
                document.getElementById('shi').style.color = '$color';
            }

            str;
        }
    ?>

    <div id="shi">
        颜色 <br>
        颜色 <br>
    </div>
    <form method="post" action="">
        <select name="color" id="">
            <option value="0">请选择颜色</option>
            <option value="1">红色</option>
            <option value="2">绿色</option>
            <option value="3">蓝色</option>
        </select>
        <input type="submit" name="button" value="改变颜色"> <!--multiple多选-->
    </form>
</body>
</html>